package com.shrct.businessprocess.customerservice.impl;

import com.shrct.businessprocess.customerservice.RCProjectMock;
import com.shrct.businessprocess.customerservice.impl.RCServiceContractDelegateImpl;
import com.shrct.businessprocess.customerservice.proxy.RCProjectMockProxy;
import com.shrct.businessprocess.organization.RCEmployee;
import com.shrct.businessprocess.product.RCLogicProduct;
import com.shrct.businessprocess.product.impl.RCLogicProductImpl;
import edu.fudan.mylang.pf.IObjectFactory;
import java.util.Collection;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;

@Entity
@DiscriminatorValue("RCPROJECTMOCK_TYPE")
public class RCProjectMockImpl extends RCServiceContractDelegateImpl implements RCProjectMock {
  public RCProjectMockImpl() {
    super();
  }
  
  public RCEmployee getBusinessMan() {
    return null;
  }
  
  public RCEmployee getMajorSales() {
    return null;
  }
  
  @ManyToMany(targetEntity = RCLogicProductImpl.class)
  @JoinTable(name = "m2m_rcprojectmock_shippinglist", joinColumns = @JoinColumn(name = "rcprojectmock_id") , inverseJoinColumns = @JoinColumn(name = "rCLogicProduct_inv_id") )
  private Collection<RCLogicProduct> shippingList = new java.util.ArrayList<com.shrct.businessprocess.product.RCLogicProduct>();;
  
  public Collection<RCLogicProduct> getShippingList() {
    return this.shippingList;
  }
  
  public RCProjectMock setShippingList(final Iterable<RCLogicProduct> shippingList) {
    removeAllShippingList();
    for(RCLogicProduct ca : shippingList){
    	addtoShippingList(ca);
    }
    return this;		
    
  }
  
  public RCProjectMock addtoShippingList(final RCLogicProduct rCLogicProduct) {
    this.shippingList.add(rCLogicProduct);
    return this;
    
  }
  
  public RCProjectMock removeAllShippingList() {
    this.shippingList.clear();
    return this;	
    
  }
  
  public RCProjectMock removeFromShippingList(final RCLogicProduct rCLogicProduct) {
    this.shippingList.remove(rCLogicProduct);
    return this;
    
  }
  
  public static RCProjectMock create(final IObjectFactory objectFactory) {
    com.shrct.businessprocess.customerservice.RCProjectMock rCProjectMock = new com.shrct.businessprocess.customerservice.impl.RCProjectMockImpl(
    );
    objectFactory.create(rCProjectMock);
    return rCProjectMock;			
    
  }
  
  public static RCProjectMock createRCProjectMockImpl(final IObjectFactory objectFactory, final Procedure1<RCProjectMock> init) {
    com.shrct.businessprocess.customerservice.RCProjectMock rCProjectMock = new com.shrct.businessprocess.customerservice.impl.RCProjectMockImpl(
    );
    objectFactory.create(rCProjectMock);
    init.apply(rCProjectMock);
    
    return rCProjectMock;			
    
  }
  
  public RCProjectMockProxy toProxy() {
    com.shrct.businessprocess.customerservice.proxy.RCProjectMockProxy proxy = new com.shrct.businessprocess.customerservice.proxy.RCProjectMockProxy();
    proxy.setId(this.getId());
    if(this instanceof edu.fudan.mylang.pf.INamedModelObject){
    	proxy.setName(((edu.fudan.mylang.pf.INamedModelObject)this).getEntityName());
    }
    return proxy;
    
  }
}
